#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QSpacerItem>
#include <QMainWindow>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLabel>

#include "Windows.h"
#include "logs.h"
#include "account_info.h"


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE


class XLabel : public  QLabel
{
    Q_OBJECT
public:
    XLabel(QWidget *parent= nullptr);
  //  XLabel(){}
    ~XLabel()override{}

signals:
    void xlabel_in();
    void xlabel_out();

protected:
    void enterEvent(QEvent *event)override;
    void leaveEvent(QEvent *event)override;
};

//主界面框架
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
 void Windowadd(int i,int btnNumber);//添加子集

private slots:
    void on_exitbnt_clicked();//退出
    void on_swap_clicked();//切换账号

    void on_radioButton_clicked();


    //   void on_Account_clicked();

    //  void on_Account_linkHovered(const QString &link);

signals:
    void reaccount();//切换账号信号
    void clicked();
 protected:
    void mousePressEvent(QMouseEvent* event)override;
private:
    //垂直布局类
    QSpacerItem *verticalSpacer;//垂直弹簧
    QFont all_font;
    std::vector<std::pair<QString,int>> leftbar;//左边栏标题和下标

    int ischick;
 //  int barNumber[10];      //每个二级菜单数量<=10(有多少一级菜单就有多少二级菜单吧)
   //QWidget *twowin;        //二级菜单窗口数量==barNumber
   std::shared_ptr<QWidget[]> twowin;
   std::shared_ptr<QPushButton[]> btn;           //一级菜单的按钮
   XLabel *Account;
   Account_INFO *user_info;
   Ui::MainWindow *ui;

   std::unique_ptr<QWidget> window;
};
#endif // MAINWINDOW_H
